<!--
 * @Description: App
 * @Autor: 赖维健(lwj1994)
 * @Date: 2021-09-28 09:51:07
 * @LastEditors: 赖维健(lwj1994)
 * @LastEditTime: 2021-11-16 20:52:49
-->
<template>
  <van-nav-bar v-if="title"
               :title="title" />

  <div class="page">
    <router-view v-slot="{ Component }">
      <keep-alive>
        <component :is="Component" />
      </keep-alive>
    </router-view>
  </div>
</template>

<script>
import { computed, defineComponent, reactive, toRefs } from 'vue'
import { useRoute, useRouter } from 'vue-router'

export default defineComponent({
  setup() {
    const state = reactive({
      active: 0
    })

    const route = useRoute()

    const title = computed(() => {
      return route.meta.title
    })

    return {
      ...toRefs(state),
      title
    }
  }
})
</script>

<style lang="less" scoped>
</style>